<?php

include 'AbstractDAO.php';

class ProductDAO extends AbstractDAO {

    public static function getInstance() {
        if (!self::$instance) {
            self::$instance = new self();
        }
        return self::$instance;
    }

    public function __construct() {
        parent::__construct();
    }

    public function readAll() {
        return $this->db->get('product')->result_array();
    }

    public function reaByID($id) {
        return $this->db->get_where('product', array('ProductID' => $id))->result_object();
    }

    public function getImages($id) {
        return $this->db->get_where('productimage', array('ProductID' => $id))->result_object();
    }

    public function readLates($num = 20) {
        return $this->db->get('product', 'a');
    }

}

?>